import BaseService from './_BaseService'
import axios from "axios";
import config from "../config";

class AccountService extends BaseService {
  root = window.apiPath + '/work-plans'

  createWorkPlans (entity) {
    return axios.post(config.SERVER_URL + this.root, {...entity, responseType: 'json'})
      .then(resp => resp)
  }

  editWorkPlans (entity) {
    return axios.put(config.SERVER_URL + this.root, {...entity, responseType: 'json'})
      .then(resp => resp)
  }

  searchList (query = '', page = 0, pageSize = config.PAGE_SIZE) {
    return axios.get(config.SERVER_URL + this.root + `-ps?query=${query}&page=${page}&size=${pageSize}`, {responseType: 'json'})
      .then(resp => resp)
  }

  delWorkPlans (id) {
    return axios.delete(config.SERVER_URL + this.root + '/' + id, {responseType: 'json'})
      .then(resp => resp)
  }
}

export default new AccountService()
